﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Com.CMS263.BLL;
using Com.CMS263.PO;
using Com.CMS263.Util;

namespace Com.CMS263.Web.manage.ProductManage
{
    public partial class product_img_list : System.Web.UI.Page
    {
        public int ProductId;
        public Product pp;
        public IList<ProductImage> prodlist = new List<ProductImage>();
        ProductImagesBLL pibll = new ProductImagesBLL();
        
        public int page = 0;
        public int pagecount = 0;
        public int pagesize = 10;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ProductId = Convert.ToInt32(Request["ProductId"]);
                page = Convert.ToInt32(Request["page"]);
                if (page == 0)
                {
                    page = 1;
                }
                prodlist = pibll.GetListByPager(ProductId, page, pagesize);
            }
        }
        ProductBLL pbll = new ProductBLL();
        public Product GetProduct(object obj)
        {
            int ProductId = Convert.ToInt32(obj);
            pp = (Product)pbll.FindModelById("Product", ProductId);
            if (pp == null || pp.Id < 1)
            {
                pp = new Product();
            }
            return pp;
        }

       
        public string GetPager()
        {
            ProductId = Convert.ToInt32(Request["ProductId"]);
            pagecount = pibll.GetListByPager(ProductId);
            return EnPager.GetPager(pagecount, pagesize, page, "&ProductId=" + ProductId);
        }
    }
}
